<?php
/**
* @version 0.1
* @package dok
* @copyright Derek OKeeffe and Alinea Interactive
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* 
* Used to integrate Joomla 1.5 with Knowledgetree. 
* 
*/
require_once( 'configuration.php' );

$config = new JConfig();

if (!($resource = @mysql_connect( $config->host, $config->user, $config->password, true ))) {
			echo 'Could not connect to MySQL';
			exit();
} 

mysql_select_db($config->db, $resource);

$cookie = $_GET['cookie'];

$result = mysql_query("SELECT username FROM jos_session WHERE session_id = '$cookie'");
if ($result) {
      $user = mysql_fetch_array($result);
      echo $user[0];
}

mysql_close($resource);
?>